package com.bwie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.pojo.TbOrderRecord;
import com.bwie.service.TbOrderRecordService;
import com.bwie.mapper.TbOrderRecordMapper;
import com.bwie.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author andy
* @description 针对表【tb_order_record(订单记录表)】的数据库操作Service实现
* @createDate 2025-05-30 09:27:47
*/
@Service
public class TbOrderRecordServiceImpl extends ServiceImpl<TbOrderRecordMapper, TbOrderRecord>
    implements TbOrderRecordService{

    @Autowired
    TbOrderRecordMapper tbOrderRecordMapper;
    @Override
    public Result getOrderRecordList(Integer orderId) {

        List<TbOrderRecord> tbOrderRecords = tbOrderRecordMapper.selectList(
                // 订单记录根据创建时间正序排列
                new QueryWrapper<TbOrderRecord>().lambda()
                        .eq(TbOrderRecord::getOrderId, orderId)
                        .orderByAsc(TbOrderRecord::getCreateTime)
        );

        return Result.ok().setData(tbOrderRecords);
    }
}




